<template>
	<view class="onebox" @click="toLogsDetails()">
		<image :src="item.cover" mode="" class="picture"></image>
		<view class="title">
			{{item.title}}
		</view>
		<view class="bottom">
			<image :src="item.head" mode="" class="circle"></image>
			<view class="name">
				{{item.uname}}
			</view>
			<view class="likes">
				<image :src="likeImage[this.likeImageNumber]" mode="" class="like" @click="activelike()"></image>
				<view class="number">
					{{item.likenumber}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"tribeIndex",
		props:{
			item:{
				type:Object,
				default(){
					return {
						title:'会做攻略的旅游搭子泰酷啦！',
						uname:'我是大美女',
						cover:'',
						likeNumber:0,
						head:''
						
					}
				}
			}
		},
		data() {
			return {
				likenumber:0,
				likeImage:[
					'../../static/likeIt.png',
					'../../static/activeLike.png'
				],
				likeImageNumber:0,
				flag:true
			};
		},
		methods: {
			activelike(){
				this.likenumber=this.flag?this.likenumber+1:this.likenumber-1
				this.likeImageNumber=this.flag?this.likeImageNumber+1:this.likeImageNumber-1
				this.flag=!this.flag
				event.stopPropagation()
			},
			toLogsDetails(){
				uni.navigateTo({
					url:'/pages/tribe/details/logsDetails'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.onebox {
		height: 465rpx;
		width: 340rpx;
		background-color: rgb(227, 251, 252);
		display: inline-block;
		margin-left: 25rpx;
		margin-top: 40rpx;
		border-radius: 55rpx;
		
		.picture {
			background-color: pink;
			height: 280rpx;
			width: 240rpx;
			border-radius: 50rpx;
			margin-top: 31rpx;
			margin-left: 20rpx;
		}
		.title {
			color: #4b5357;
			font-size: 28rpx;
			font-weight: bold;
			width: 300rpx;
			margin-left: 23rpx;
			// background-color: skyblue;
		}
		.bottom {
			height: 60rpx;
			width: 340rpx;
			position: absolute;
			
			.circle {
				display: inline-block;
				height: 56rpx;
				width: 56rpx;
				border-radius: 28rpx;
				margin-left: 20rpx;
				position: relative;
				top: 5rpx;
				background-color: pink;
			}
			.name {
				position: relative;
				top: -25rpx;
				display: inline-block;
				margin-left: 10rpx;
				font-size: 25rpx;
				font-weight: bold;
				height: 60rpx;
				width: 160rpx;		
			}
			.likes {
				position: relative;
				top: 5rpx;
				display: inline-block;
				width: 90rpx;
				height: 50rpx;
				
				.like {
					width: 60%;
					height: 100%;
					display: inline-block;
				}
				.number {
					height: 100%;
					width: 40%;
					font-size: 25rpx;
					display: inline-block;
					position: relative;
					top: -15rpx;
					text-align: center;
				}
			}
		}
	}
</style>